#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>

int main(int argc, char *argv[])
{
    int status;
    pid_t pid = fork();

    if(pid == 0) {
        sleep(16);
        return 24;
    } else {
        while(!waitpid(-1, &status, WNOHANG)) {
            sleep(3);
            puts("休眠3秒钟");
        }
        if(WIFEXITED(status)) {
            printf("子进程返回值 %d \n", WEXITSTATUS(status));
        }
    }

    return 0;
}